package com.om.base;

import java.sql.Connection;

public class ReleaseConnection {

	private int ownerThreadId = 0;
	private long releaseTime = 0;
	private Connection connection = null;

	public Connection getConnection() {
		return connection;
	}

	public void setConnection(Connection connection) {
		this.connection = connection;
	}

	private int state = 1;

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public int getOwnerThreadId() {
		return ownerThreadId;
	}

	public void setOwnerThreadId(int ownerThreadId) {
		this.ownerThreadId = ownerThreadId;
	}

	public long getReleaseTime() {
		return releaseTime;
	}

	public void setReleaseTime(long releaseTime) {
		this.releaseTime = releaseTime;
	}

	public void close() {
		try {
			if (state == 1 && connection != null && !connection.isClosed()) {
				connection.close();
			}
			state = 0;
		} catch (Exception ex) {

		}
	}

}
